﻿using ApiLib.AppStart;
using SqlSugar;

namespace ApiLib.Models;

/// <summary>
/// 自定义表格字段
///</summary>
[Tenant(GlobalConstants.MainDbConfigId), SugarTable("sys_table_field_info")]
public class SysTableFieldInfo
{
    /// <summary>
    ///  
    ///</summary>
    [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
    public int Id { get; set; }

    /// <summary>
    /// 表id 
    ///</summary>
    [SugarColumn(ColumnName = "table_id")]
    public int TableId { get; set; }

    /// <summary>
    /// 字段名 
    ///</summary>
    [SugarColumn(ColumnName = "field_name")]
    public string FieldName { get; set; }

    /// <summary>
    /// 展示的字段名 
    ///</summary>
    [SugarColumn(ColumnName = "field_name_display")]
    public string FieldNameDisplay { get; set; }

    /// <summary>
    /// 字段描述 
    ///</summary>
    [SugarColumn(ColumnName = "field_explain")]
    public string FieldExplain { get; set; }

    /// <summary>
    /// 字段类型 
    ///</summary>
    [SugarColumn(ColumnName = "field_type")]
    public TableFieldType FieldType { get; set; }

    /// <summary>
    /// 字段提示信息 
    ///</summary>
    [SugarColumn(ColumnName = "field_placeholder")]
    public string FieldPlaceholder { get; set; }

    /// <summary>
    /// 非空 
    ///</summary>
    [SugarColumn(ColumnName = "not_null")]
    public bool NotNull { get; set; }

    /// <summary>
    /// 禁用 
    ///</summary>
    [SugarColumn(ColumnName = "disable")]
    public bool Disable { get; set; }

    /// <summary>
    /// 默认值 
    ///</summary>
    [SugarColumn(ColumnName = "default_value")]
    public string DefaultValue { get; set; }

    /// <summary>
    /// 默认选项 
    ///</summary>
    [SugarColumn(ColumnName = "default_options")]
    public string DefaultOptions { get; set; }

    /// <summary>
    /// 创建人 
    ///</summary>
    [SugarColumn(ColumnName = "create_user")]
    public string CreateUser { get; set; }

    /// <summary>
    /// 创建时间 
    ///</summary>
    [SugarColumn(ColumnName = "create_time")]
    public DateTime CreateTime { get; set; }
}
public enum TableFieldType
{
    /// <summary>
    /// 输入框
    /// </summary>
    Input = 10,

    /// <summary>
    /// 数字输入框
    /// </summary>
    InputNumber = 11,

    /// <summary>
    /// 小数
    /// </summary>
    InputDouble = 12,

    /// <summary>
    /// 文本输入框
    /// </summary>
    TextArea = 13,

    /// <summary>
    /// 单选框
    /// </summary>
    Radio = 20,

    /// <summary>
    /// 多选框
    /// </summary>
    CheckBox = 21,

    /// <summary>
    /// 下拉选项框
    /// </summary>
    Select = 22,

    /// <summary>
    /// 下拉多选
    /// </summary>
    MultiSelect = 23,

    /// <summary>
    /// 日期时间输入框
    /// </summary>
    DateTime = 30,

    /// <summary>
    /// 图片
    /// </summary>
    Image = 40,

    /// <summary>
    /// 附件
    /// </summary>
    File = 41,

    /// <summary>
    /// 自动获取定位
    /// </summary>
    Location = 50,

    /// <summary>
    /// 用户
    /// </summary>
    UserInfo = 51,
    /// <summary>
    /// 部门
    /// </summary>
    Department = 52,
}